<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //1.字面量方式
    //let obj = {
    //    name:"tom",
    //    age:18,
    //    showName(){
    //        console.log(this.name);
    //    }
    //}
    //obj.showName()

    //2.object()来创建
    //let obj = new Object();
    //console.log(obj);
    //obj.name = "tom";
    //obj.age = 18;
    //obj.showName = function(){
    //    console.log(this.name);
    //}
    //obj.showName()

    //3.工厂模式创建对象
    //function person(a,b,c){
    //    var o = new Object();
    //    o.a=a;
    //    o.b=b;
    //    o.c=c;
    //    o.dd = function(){
    //        console.log(this.a,this.b,this.c);
    //    }
    //    console.log(o);
    //    return o;
    //}
    //var p1 = person(1,2,3)
    //console.log(p1.a,p1.b,p1.c);

    //4.
</script>
</html>